Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Teleop with teleop_twist_keyboard
Description: This tutorial explains how to teleop a simulated robot using teleop_twist_keyboardTutorial Level: BEGINNER
Contents
Install teleop_twist_keyboard package
First, you must install the teleop_twist_keyboard package:
sudo apt-get install ros-hydro-teleop-twist-keyboard
Run teleop_twist_keyboard
Now, simply run the teleop_twist_keyboard node, and remap its cmd_vel topic to the robot use wish to control. For example, to control robot0, run:
rosrun teleop_twist_keyboard teleop_twist_keyboard.py cmd_vel:=robot0/cmd_vel
Teleoperate your robot!
Simply follow the on-screen instructions to teleop your robot:
i: Forward
,: Backwards
k: Stop
j: Rotate Left in place
l: Rotate Right in place
--------------------------- Moving around: u i o j k l m , . q/z : increase/decrease max speeds by 10% w/x : increase/decrease only linear speed by 10% e/c : increase/decrease only angular speed by 10% anything else : stop CTRL-C to quit
Optional: Create a launch file
If you wish to create a launch file to teleop your robot in simulation, you could use:
<launch> <node pkg="teleop_twist_keyboard" type="teleop_twist_keyboard.py" name="teleop"> <remap from="cmd_vel" to="robot0/cmd_vel"/> </node> </launch>